<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        全选<input type="checkbox" v-model="checkAll"> <button @click="reverse">反选</button> <br>
        
        <input type="checkbox" v-for="product in products" v-model="product.isSelected">
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            data: {
                products:[
                    {isSelected: true},
                    {isSelected: true},
                    {isSelected: true}
                ]
            },
            computed:{
                checkAll:{
                    get(){
                        return this.products.every(item=>item.isSelected)
                    },
                    set(val){
                        this.products.forEach(item=>item.isSelected = val)
                    }
                }
            },
            methods:{
                reverse(){
                    this.products.forEach(item=>item.isSelected = !item.isSelected)
                }
            }
        })
    </script>
</body>
</html>